package com.example.back.controller;

import com.example.back.dto.req.HospitalEditReq;
import com.example.back.dto.resp.HospitalResp;
import com.example.back.service.HospitalService;
import com.example.common.support.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @Author wxy
 * @Date 2021/1/14 13:40
 * @Version 1.0
 */
@RestController
@Api(tags = "医院信息管理")
@RequestMapping("/api/Hospital")
public class HospitalController {
    @Resource
    private HospitalService hospitalService;

    @ApiOperation(value = "医院信息", notes = "医院信息")
    @PostMapping(value = "/Info")
    public Result<HospitalResp> Info() {
        return Result.success(hospitalService.Info());
    }

    @ApiOperation(value = "上传文件", notes = "上传文件")
    @PostMapping(value = "/UpLoad")
    public Result<Object> UpLoad(@RequestParam(value = "file") MultipartFile file) {
        return Result.success(hospitalService.UpLoad(file));
    }

    @ApiOperation(value = "更新 医院信息", notes = "更新 医院信息")
    @PostMapping(value = "/UpdateInfo")
    public Result<Object> UpdateInfo(@RequestBody HospitalEditReq req) {
        return Result.success(hospitalService.UpdateInfo(req));
    }
}
